#define _CRT_SECURE_NO_WARNINGS 1


#include "SeqList.h"

void SLInite(SL* p)
{
	p->arr = NULL;
	p->size = p->capacity = 0;
}

void SLD(SL* p)
{
	p->size = p->capacity = 0;
	if (p->arr)
	{
		free(p);
		p = NULL;
	}
}

void SLPushBack(SL* s, SLData n)
{
	assert(s);
	if (s->size == s->capacity)
	{
		size_t NewCapacity = ((s->capacity) == 0 ? 4 : 2 * (s->capacity));
		s->capacity = NewCapacity;
		SLData* pl = realloc(s->arr, 2 * (s->capacity) * sizeof(SLData));
		if (pl)
		{
			perror("realloc");
			exit(0);
		}
		s->arr = pl;
		s->arr[s->size++] = n;
	}
}

